package com.sqsf.mapper;

import com.sqsf.javabean.Video;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface VideoMapper {
    @Select("select * from video where tid=#{tid}")
    List<Video> selectByTid(int tid);
    @Select("select * from video where courseName like '%${courseName}%' or title like '${courseName}'")
    List<Video> selectAll(String courseName);

    @Insert("insert into video(courseName, title, description, videoUrl, tid)values(#{courseName}, #{title}, #{description}, #{videoUrl}, #{tid})")
    int insert(Video video);
    @Delete("delete from video where id=#{id}")
    int deleteById(int id);
    @Select("select * from video where id=#{id}")
    Video selectById(int id);
    @Update("update video set courseName=#{courseName},title=#{title},description=#{description},videoUrl=#{videoUrl} where id=#{id}")
    int update(Video video);
}